﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EditModelField.aspx.cs" Inherits="Manage_Modle_ModelField_EditModelField" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script language="Javascript" src="../../js/ajax.js" type="text/javascript"></script>
    <link href="../../css/ModelField.css" rel="stylesheet" type="text/css" />
    <script language="javascript">
        function getInfo(FieldID,getType, TypeID)
        {
            document.getElementById('hidFieldID').value=FieldID;
            document.getElementById('hidGetType').value=TypeID;
            var strData = "type=" + getType + "&fieldid=" + FieldID;
            ajax.Post("AjaxPost.aspx", strData, divShow);
        }
        function divShow(FieldID)
        {
            if(ajax.IsReady())
            {
                var strRet = ajax.ResponseText();
                if(strRet == "-1")
                {
                    //-1:表示不存在
                }
                else
                {
                    document.getElementById("_coverWait").style.display = "block";
                    document.getElementById("divChangeFieldInfo").style.display = "block";
                    document.getElementById('txtFileInfo').value=strRet;
                }
            }
        }
        function divHide()
        {
            document.getElementById("_coverWait").style.display = "none";
            document.getElementById("divChangeFieldInfo").style.display = "none";
        }
        function FunChange()
        {
            if(confirm('您确定要修改此内容吗?'))
            {
                var FieldID = document.getElementById('hidFieldID').value;
                if(document.getElementById('hidGetType').value == "1")
                {                
                    var strData = "type=setFieldInfo&fieldid=" + FieldID + "&fieldinfo=" + escape(document.getElementById("txtFileInfo").value);
                    ajax.Post("AjaxPost.aspx", strData, RefFunChange);
                }
                else
                {   
                    var strData = "type=setFieldHelpInfo&fieldid=" + FieldID + "&fieldinfo=" + escape(document.getElementById("txtFileInfo").value);
                    ajax.Post("AjaxPost.aspx", strData, RefFunChange);
                }
            }
        }
        function RefFunChange()
        {
            if(ajax.IsReady())
            {
                var strRet = ajax.ResponseText();
                divHide();
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
   <div id="_coverWait" style=" left:0px; top:0px; display:none; Z-INDEX: 999; BACKGROUND: #333333;FILTER: alpha(opacity=0); WIDTH: 100%; POSITION: absolute; HEIGHT: 1000px">
        <iframe width="0" height="0" style="position:absolute; top:0px; z-index:-1; border-style:none; border-width:0px; border:0px; BACKGROUND: #333333; FILTER: alpha(opacity=30);" >
        </iframe>
    </div>
    <div id="divChangeFieldInfo" align="center" style="z-index:1000; border: 8px solid #8a99c0; display:none; background-color:White; position:absolute; left:100px; margin-top:200px;">
        <input type="hidden" name="hidFieldID" id="hidFieldID" />
        <input type="hidden" name="hidGetType" id="hidGetType" />
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td colspan="2" style="height:10px;"></td>
            </tr>
            <tr>
                <td align="center">请在些输入此字段对应的信息</td>
            </tr>
            <tr>
                <td style="padding:4px 4px 4px 4px;">
                    <textarea name="txtFileInfo" rows="2" cols="20" id="txtFileInfo" style="height:200px;width:400px;"></textarea>
                </td>
            </tr>
            <tr>
                <td style="height:10px;"></td>
            </tr>
            <tr>
                <td  align="center">
                    <input type="button" name="btnChange" value="修改" onclick="FunChange()"  />
                    <input id="btnCancel" type="button" value="取消" onclick="divHide()" />
                </td>
            </tr>
            <tr>
                <td style="height:10px;"></td>
            </tr>
        </table>        
    </div>
    <div align="center">
        <table cellpadding="0" cellspacing="0" class="list">
            <tr>
                <th>模块名称</th>
                <th>模块标识</th>
                <th>模块区分</th>
                <th>评论系统</th>
                <th>回复功能</th>
                <th>设置</th>
            </tr>
            <tr>
                <td><asp:DropDownList ID="ddlPermission" runat="server" DataTextField="Permission_Name" DataValueField="Permission_Id" OnSelectedIndexChanged="ddlPermission_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList></td>
                <td><asp:TextBox ID="txtModel" runat="server" Enabled="false"></asp:TextBox></td>
                <td><asp:TextBox ID="txtModelKeyID" runat="server" Enabled="false"></asp:TextBox></td>
                <td>
                    <asp:RadioButtonList ID="rblIsCommentFlag" runat="server" RepeatColumns="2" AutoPostBack="true" OnSelectedIndexChanged="rblIsCommentFlag_SelectedIndexChanged">
                        <asp:ListItem Text="无" Value="0" Selected="true"></asp:ListItem>
                        <asp:ListItem Text="有" Value="1"></asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td>
                    <asp:RadioButtonList ID="rblIsRevertFlag" Enabled="false" runat="server" RepeatColumns="2">
                        <asp:ListItem Text="无" Value="0" Selected="true"></asp:ListItem>
                        <asp:ListItem Text="有" Value="1"></asp:ListItem>
                    </asp:RadioButtonList>
                    <asp:HiddenField ID="hidCatID" runat="server" />
                </td>
                <td>
                    <asp:Button ID="btnSet" runat="server" Text="设置" OnClick="btnSet_Click" />
                </td>
            </tr>
        </table>
        <br />
        <asp:GridView ID="gvModelField" runat="server" CellPadding="4" ForeColor="#333333" CssClass="list" GridLines="None" OnRowDataBound="gvModelField_RowDataBound" OnRowCommand="gvModelField_RowCommand" AutoGenerateColumns="False" OnRowUpdating="gvModelField_RowUpdating">
            <Columns>
                <asp:BoundField HeaderText="字段编号" DataField="mf_FieldID"/>
                <asp:BoundField HeaderText="字段名称" DataField="mf_FieldName" />
                <asp:TemplateField HeaderText="显示名称">
                    <ItemTemplate>
                        <asp:TextBox ID="txtMF_FieldLabel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "mf_FieldLabel") %>' Width="100px"></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="状态">
                    <ItemTemplate>
                    <asp:RadioButtonList id="rblMF_DisplayFlag" runat="server" RepeatColumns="2" Enabled='<%# DataBinder.Eval(Container.DataItem, "mf_MustField").ToString() == "1" ? false : true %>'>
                        <asp:ListItem Text="隐藏" Value="0"></asp:ListItem>
                        <asp:ListItem Text="显示" Value="1"></asp:ListItem>
                    </asp:RadioButtonList>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="验证">
                    <ItemTemplate>
                        <asp:DropDownList ID="ddlMF_ValidateField" runat="server" DataTextField="RegexName" DataValueField="RegexID">
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="必填">
                    <ItemTemplate>
                        <asp:CheckBox ID="chkRequiredField" runat="server" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="排序">
                    <ItemTemplate>
                        <asp:TextBox ID="txtMF_Order" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "mf_Order") %>' Width="30px"></asp:TextBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:ImageButton ID="btnEdit" runat="server" ImageUrl="../../images/edit2.gif" CommandName="Update" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "mf_FieldID") %>' ToolTip="修改" />
                        <img src="../../images/fieldinfo.gif" alt="字段内容" onclick="getInfo('<%# DataBinder.Eval(Container.DataItem, "mf_FieldID") %>', 'getFieldInfo', '1')" style="cursor:hand;" />
                        <img src="../../images/help.gif" alt="帮助内容" onclick="getInfo('<%# DataBinder.Eval(Container.DataItem, "mf_FieldID") %>', 'getFieldHelpInfo', '2')" style="cursor:hand;" />
                        <asp:Button ID="btnChangeDisplayFlag" runat="server" CommandName="DisplayFlag" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "mf_FieldID") %>' Text='<%# (DataBinder.Eval(Container.DataItem, "mf_DisplayFlag")).ToString() == "1" ? "隐藏" : "显示" %>' Enabled='<%# DataBinder.Eval(Container.DataItem, "mf_MustField").ToString() == "1" ? false : true %>' />
                        <asp:Button ID="btnMustField" runat="server" CommandName="IsMustField" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "mf_FieldID") %>' Text='<%# (DataBinder.Eval(Container.DataItem, "mf_MustField")).ToString() == "1" ? "可选" : "必选" %>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#E8F0FB" Font-Bold="True" />
            <AlternatingRowStyle BackColor="#E8F0FB" />
        </asp:GridView>
        <br />
        <asp:Button ID="btnSaveAndCreate" runat="server" Text="保存并生成" OnClick="btnSaveAndCreate_Click" />&nbsp;&nbsp;
        <asp:Button ID="btnCreate" runat="server" Text="生成" OnClick="btnCreate_Click" />&nbsp;&nbsp;
        <%--<asp:Button ID="btnRenew" runat="server" Text="恢复默认" OnClick="btnRenew_Click" />--%>
    </div>
    </form>
</body>
</html>
